#include <stdio.h>
#include "json_wrapper.h"

int main(int argc, char const *argv[])
{
    JsonObject *root = json_object_create();
    json_object_put_string(root,"type","true");
    json_object_put_number(root,"price",100);
    json_object_save_to_file(root,"list.txt");
    json_free(root);
    
    JsonObject *read = json_object_create();
    FILE *fp = fopen("list.txt","r+");
    char str[256] = {0};
    fread(str,256,1,fp);
    printf("%s\n", str);
    printf("***************\n");
    read = json_object_parse(str);
    printf("%s\n", json_object_get_string(read, "type", "error"));
    printf("%d\n", json_object_get_number(read, "price", -1));
    json_free(read);

    
    return 0;
}

